import {lazy} from "react";
import {flattenRoutes} from "../utils";
// import {HomeOutlined} from "@ant-design/icons";

const Layout = lazy(() => import("@/views/Layout"));
const Nofound = lazy(() => import("@/views/404"));
const Login = lazy(() => import("@/views/Login"));
const Home = lazy(() => import("@/views/Home"));
const Homess = lazy(() => import("@/views/Homess"));

export const routes: Routers.Route[] = [
  {
    title: "登录",
    path: "/login",
    component: Login,
  },
  {
    title: "404",
    path: "/404",
    exact: true,
    component: Nofound,
  },
];

export const DynamicRoutes: Routers.Route[] = [
  {
    title: "首页",
    path: "/home",
    role: [0, 1],
    // icon: <HomeOutlined />,
    component: Layout,
    redirect: "/home/index",
    children: [
      {
        title: "人员概况",
        path: "/home/index",
        role: [0, 1],
        component: Home,
      },
      {
        title: "营业统计",
        path: "/home/index2",
        role: [0, 1],
        component: Homess,
      },
    ],
  },
];

export const flattenRoute = flattenRoutes([...routes, ...DynamicRoutes]);
